<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
    <style type="text/css">
      #d_tag2 { position:absolute; z-index:1111; float:left; left:4px; top:2px;  
	          font-size:12px;
              font-family:Verdana, "Lucida Grande", Arial, Helvetica, sans-serif; } 
	  #d_tag2 span { cursor:default; display:inline-block; border:solid 1px #ccc; background-color:#ffffcc; border-radius:5px; padding:2px 4px; margin-right:4px;}
	  
	  .uploadifyDiv{
	  	position: relative;  
	  }
	  
	  .uploadifyDesc{
		position:absolute; 
		left:100px; 
		top:-2px; 
		height:30px; 
		line-height:30px; 
		width:570px; 
		background-color: #f5faff; 
		padding-left: 10px;
		}  
    </style>
    
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/seriesComboBoxs/jquery.seriesComboBoxs.js" charset="utf-8"></script>
    <link href="${pageContext.request.contextPath}/js/uploadify/uploadify.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/uploadify/jquery.uploadify.js"></script>
     
<script type="text/javascript">
	$(function(){
	 	 $(".listtable").zebra(); 
	 	//问题级别类型
		$('#problemLevel_affirm').combobox({
		    url:'${pageContext.request.contextPath}/problemmgr/problemAction!getDic.action?codeType=warnLevel',  
			valueField:'codeValue',  
			textField:'codeName',
			required: true,
			value:${problem.problemLevel},
		    disabled:true,
		    onLoadSuccess: function(){
		    	$('#problemLevel_affirm_show').val($('#problemLevel_affirm').combobox('getText'));
			}
	    });
	 	
		//问题来源
		$('#problemOrigin_affirm').combobox({
		    url:'${pageContext.request.contextPath}/problemmgr/problemAction!getDic.action?codeType=requireSrc',  
			valueField:'codeValue',  
			textField:'codeName',
			required: true,
			value:${problem.problemOrigin},
		    disabled:true,
		    onLoadSuccess: function(){
		    	$('#problemOrigin_affirm_show').val($('#problemOrigin_affirm').combobox('getText'));
			}
	    });
	});	
		
		
			
		
	

	$(document).ready(function(){
		 //显示附件列表
		   showFileList();
	       $('#file_upload').uploadify({ 
	    	    //开启调试
	            'debug' : true,
			    'formData':{
			    	"bussId" : ${problem.taskId}, 
	   				"bussType":"0"		
			  	 },  
				'cancelImg': '${pageContext.request.contextPath}/js/uploadify/uploadify-cancel.png', 
				'swf'    : '${pageContext.request.contextPath}/js/uploadify/uploadify.swf',
				'uploader' : '${pageContext.request.contextPath}/upload/fileAction!multipleUpload.action',
				'multi':'true', 
				'buttonText':'', 
				'width': 88, 
			    'height': 26,       
				'removeTimeout' : 2,           //默认进度条延迟消失时间 单位秒
				'queueID':'uploadfileQueue',
				'fileSizeLimit' : '60MB', 
				'fileTypeExts':'*.txt;*.rar;*.zip;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.jpeg;*.gif;*.png',
				 'queueSizeLimit' : 10, 
				 'overrideEvents':['onSelectError'],  
				'onQueueComplete':function(queueData){
					//刷新附件列表 
					$("#divDatagrid").css("display","block"); 
					showFileList();
				},
				 //返回一个错误，选择文件的时候触发
		        'onSelectError':function(file, errorCode, errorMsg){
		            switch(errorCode) {
		                case -100:
		                    alert("上传的文件数量已经超出系统限制的"+$('#file_upload').uploadify('settings','queueSizeLimit')+"个文件！");
		                    break;
		                case -110:
		                    alert("文件 ["+file.name+"] 大小超出系统限制的"+$('#file_upload').uploadify('settings','fileSizeLimit')+"大小！");
		                    break;
		                case -120:
		                    alert("文件 ["+file.name+"] 大小异常！");
		                    break;
		                case -130:
		                    alert("文件 ["+file.name+"] 类型不正确！");
		                    break;
		            }
		            return;
		        },
		        //检测FLASH失败调用
		        'onFallback':function(){
		            alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
		        },
		        //上传到服务器，服务器返回相应信息到data里
		        'onUploadSuccess':function(file, data, response){
		            //alert(data);
		        },
		        //某个文件开始上传的时候触发
		        'onUploadStart' : function(file) {
		        	$("#divNoneData").css("display","none"); 
		        }
			}); 
		 
		//增加隔行变色效果
 	     $(".listtable").zebra();
		 
	 });
    
    
	//显示附件列表
   function showFileList() {
  		//刷新页面  problemmgr
  		$('#table_datagrid').datagrid({
  			url:'${pageContext.request.contextPath}/upload/fileAction!toProblemListUploadFiles.action',
  			queryParams:{
  				"bussId" : ${problem.problemId}+','+${problem.taskId},
  				"bussType":"0"	
  			},
  			fit:true,
  			border:false,
  			fitColumns:true,
  			pagination:false,
  			pageList:[10,20,30],
  			rownumbers:false,
  			singleSelect:true,                   
  			autoRowHeight:true,
  			sortName:'uploadTime',
  			sortOrder:'asc', 
  			onLoadSuccess:function(data){
  				if(data.rows.length==0){                              //判断是否有值 没值隐藏该datagrid 并显示提上上传的图片
  					$("#divDatagrid").css("display","none"); 
  					$("#divNoneData").css("display","block");
  				}else{
  					$("#divNoneData").css("display","none"); 
  				}
  			},
  			columns:[[{
  				field:'fileName',
  				title:'附件名称',
  				width:200 
  			},{
  				field:'uploadUserName',
  				title:'上传人',
  				width:60
  			 },{
  				field:'fileSize',
  				title:'附件大小',
  				width:60
  			 },{
  				field:'uploadTime',
  				title:'上传时间',
  				width:150 
  			},{
  				field:'fileId',
  				title:'操作',
  				width:150,
  				align:'center', formatter: function (fileId,rowData,rowIndex){  
						return '<span  style="cursor:pointer" onclick="downLoadFile(\''+fileId+'\')" )"><img onclick="downLoadFile(\''+fileId+'\')" src="${pageContext.request.contextPath}/images/icons/downFile.png" title="下载" alt="下载"/>下载</span>'; 
  				}
  			}]],
  		});  
  	}
	  
	  
	  
 //附件下载
	function downLoadFile(fileId){
		$("#fileDownFrame").attr("src","${pageContext.request.contextPath}/upload/fileAction!toDownLoadFile.action?fileId="+fileId);
	}
   
    //删除附件
  	function doDeleteFile(fileId){
       var pars="fileId="+fileId;
  		$.messager.confirm('删除确认', '确定要删除该条记录吗？',function(r){
  			if(r){ 
	   			$.ajax({
	   				 url :'${pageContext.request.contextPath}/upload/fileAction!toDeleteFile.action',
	   				 data:pars,
	   				 dataType :'json',
	   				 success : function(data){
	   					 if(data=='success'){
	   						//重新刷新表格
	   						 showFileList();
	   					 }else{
	   						 alert('error');
	   					 }
	   				 }
	   	   }); 
  			}
  		});
  	}
	
	
	//弹出页面
	function showHandler(){		
		$('<div id="handlerClose"/>').dialog({
			href:'${pageContext.request.contextPath}/problemmgr/problemAction!toHandlerPage.action',
			top:($(window).height()-150)*0.5,
		    left:($(window).width()-300)*0.5,
			width:400,
			height:220,
			modal:true,
			title:'选择处理人',			
			onClose:function(){
				$(this).dialog('destroy');
			}
		});
	}
	
	
</script>
<div class="easyui-tabs" style="width:auto;height:300px">
	<div title="审核问题" style="padding:0px">
		<form id="problem_affirm_form" method="post">
		 	<input id="problemId_affirm" name="problemId" class="easyui-validatebox" style="width:150px;display: none" value="${problem.problemId}"/>
	 	<input id="taskId_affirm" name="taskId" class="easyui-validatebox" style="width:150px;display: none" value="${problem.taskId}"/>
	 	<input id="executionId_affirm" name="executionId" class="easyui-validatebox" style="width:150px;display: none" value="${problem.executionId}"/>
	 	<table border="0" cellpadding="0" cellspacing="0" height="100%"  width="100%" class="listtable">
		    <tr>
		      <td height="40px" align="right">问题主题：&nbsp;</td>
		      <td height="40px" align="left"><input type="text" id="title_affirm" name="title" disabled="disabled" class="easyui-validatebox" style="width:150px;color: #8E8E8E;cursor:default" readonly="readonly" value="${problem.title}"/></td>
		      <td height="40px" align="right">问题级别：&nbsp;</td>
		      <td style="display: none">
		      	 <input id="problemLevel_affirm" type="text" class="easyui-combobox"   name="problemLevel" style="width:150px;color: #8E8E8E;cursor:default" panelHeight="auto" readonly="readonly"/>
		      </td>
		      <td height="40px" align="left">
		      	 <input id="problemLevel_affirm_show" type="text" class="easyui-validatebox"   style="width:150px;color: #8E8E8E;cursor:default" panelHeight="auto" readonly="readonly"/>
		      </td>
		     </tr>
		     
		     <tr>
		      <td height="40px" align="right">问题来源：&nbsp;</td>
		      <td style="display: none">
		      	 <input id="problemOrigin_affirm" type="text" class="easyui-combobox"  name="problemOrigin" style="width:150px;color: #8E8E8E" value="${problem.title}"/>
		      </td>
		      <td height="40px" align="left">
		      	 <input id="problemOrigin_affirm_show" type="text" class="easyui-validatebox"  style="width:150px;color: #8E8E8E;cursor:default" value="${problem.title}"/>
		      </td>
		      <td height="40px"></td>
		      <td height="40px"></td>
		     </tr>		     
		     <tr>
		     	<td height="40px" align="right">问题描述：&nbsp;</td>
		        <td colspan="3" height="40px" align="left">
		      	  <textarea id="problemDesc_affirm" name="problemDesc" readonly="readonly" style="width:90%;height:60px;resize:none;margin-top:2px;margin-bottom:2px;cursor:default;color: #8E8E8E"">${problem.problemDesc}</textarea>
		        </td>
		     </tr>
		     <tr>
		     	<td height="40px" align="right">解决方案：&nbsp;</td>
		        <td colspan="3" height="40px" align="left">
		      	  <textarea id="solution_affirm"  class="easyui-validatebox" readonly="readonly"  name="solution" style="width:90%;height:60px;resize:none;margin-top:2px;cursor:default;color: #8E8E8E">${problem.solution}</textarea>
		        </td>
		     </tr>
	    </table>
	 	</form>
	</div>
	<div title="附件上传" style="padding:10px;">
	        <br/>
			<form class="uploadifyDiv">
				<!-- 用于显示进度条 -->
				<div id="uploadfileQueue"></div>    
			</form> 
		  <br/>
		  <div data-options="region:'center'" style="height:150px;width:100%;" id="divDatagrid">     
	          <table id="table_datagrid" style="height:auto" > 
			 </table> 
	      </div>  
	      <div id="divNoneData" style="width:300px; height:100px;text-align:center; padding-top:50px;margin:0px auto;"><img src="${pageContext.request.contextPath}/js/uploadify/fjnone.png"/></div>
		<iframe id="fileDownFrame" src="" style="display:none; visibility:hidden;"></iframe> 
	</div>
</div>